package fox.framework.rpc.endpoint.channel;

import fox.framework.rpc.client.message.request.RpcClientRequest;
import fox.framework.rpc.client.message.response.RpcClientResponse;
import fox.framework.rpc.client.node.RpcNode;
import fox.framework.rpc.endpoint.exchange.RpcExchange;
import fox.framework.rpc.exception.RpcRuntimeException;

/**
 * Rpc通讯通道
 * @author cuichao
 */
public interface RpcChannel{
    /**
     * 请求数据
     * @param request
     * @return
     */
    RpcClientResponse request(RpcClientRequest request) throws RpcRuntimeException;
    /**
     * 得到连接RpcNode在本地的信息
     * @return
     */
    RpcNode node();

    /**
     * Rpc通道同步接口
     */
     interface Sync  {
        /**
         * 配置同步交换器
         * @param rpcExchange
         */
        void exchange(RpcExchange rpcExchange);
    }

}
